Telegram Group & Telegram Channel
Даны 2 таблицы с названиями orders и products c колонками "order_id", "customer_id", "product_id", "order_date", "quantity" и "product_id", "product_name", "unit_price". Какой из следующих SQL запросов вернет топ-5 покупателей, которые потратили больше всего в категории "Electronics"?

A) SELECT o.customer_id, SUM(o.quantity * p.unit_price) AS total_spent
FROM orders o JOIN products p ON o.product_id = p.product_id
WHERE p.product_name LIKE '%Electronics%'
GROUP BY o.customer_id
ORDER BY total_spent DESC
LIMIT 5;

B) SELECT o.customer_id, SUM(o.quantity * p.unit_price) AS total_spent
FROM orders o JOIN products p ON o.product_id = p.product_id
WHERE p.product_id IN (SELECT product_id FROM products WHERE product_name LIKE '%Electronics%')
GROUP BY o.customer_id
ORDER BY total_spent DESC
LIMIT 5;

C) SELECT o.customer_id, SUM(o.quantity * p.unit_price) AS total_spent
FROM orders o JOIN products p ON o.product_id = p.product_id
WHERE p.product_id IN (SELECT product_id FROM products WHERE product_name LIKE 'Electronics%')
GROUP BY o.customer_id
ORDER BY total_spent DESC
LIMIT 5;

D) SELECT o.customer_id, SUM(o.quantity * p.unit_price) AS total_spent
FROM orders o JOIN products p ON o.product_id = p.product_id
WHERE p.product_id IN (SELECT product_id FROM products WHERE product_name = 'Electronics')
GROUP BY o.customer_id
ORDER BY total_spent DESC
LIMIT 5;

Ответить на вопрос можно ниже ⬇️



tg-me.com/sql_for_qa/164
Create:
Last Update:

Даны 2 таблицы с названиями orders и products c колонками "order_id", "customer_id", "product_id", "order_date", "quantity" и "product_id", "product_name", "unit_price". Какой из следующих SQL запросов вернет топ-5 покупателей, которые потратили больше всего в категории "Electronics"?

A) SELECT o.customer_id, SUM(o.quantity * p.unit_price) AS total_spent
FROM orders o JOIN products p ON o.product_id = p.product_id
WHERE p.product_name LIKE '%Electronics%'
GROUP BY o.customer_id
ORDER BY total_spent DESC
LIMIT 5;

B) SELECT o.customer_id, SUM(o.quantity * p.unit_price) AS total_spent
FROM orders o JOIN products p ON o.product_id = p.product_id
WHERE p.product_id IN (SELECT product_id FROM products WHERE product_name LIKE '%Electronics%')
GROUP BY o.customer_id
ORDER BY total_spent DESC
LIMIT 5;

C) SELECT o.customer_id, SUM(o.quantity * p.unit_price) AS total_spent
FROM orders o JOIN products p ON o.product_id = p.product_id
WHERE p.product_id IN (SELECT product_id FROM products WHERE product_name LIKE 'Electronics%')
GROUP BY o.customer_id
ORDER BY total_spent DESC
LIMIT 5;

D) SELECT o.customer_id, SUM(o.quantity * p.unit_price) AS total_spent
FROM orders o JOIN products p ON o.product_id = p.product_id
WHERE p.product_id IN (SELECT product_id FROM products WHERE product_name = 'Electronics')
GROUP BY o.customer_id
ORDER BY total_spent DESC
LIMIT 5;

Ответить на вопрос можно ниже ⬇️

BY SQL для тестировщика


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/sql_for_qa/164

View MORE
Open in Telegram


SQL для тестировщика Telegram | DID YOU KNOW?

Date: |

Dump Scam in Leaked Telegram Chat

A leaked Telegram discussion by 50 so-called crypto influencers has exposed the extraordinary steps they take in order to profit on the back off unsuspecting defi investors. According to a leaked screenshot of the chat, an elaborate plan to defraud defi investors using the worthless “$Few” tokens had been hatched. $Few tokens would be airdropped to some of the influencers who in turn promoted these to unsuspecting followers on Twitter.

The S&P 500 slumped 1.8% on Monday and Tuesday, thanks to China Evergrande, the Chinese property company that looks like it is ready to default on its more-than $300 billion in debt. Cries of the next Lehman Brothers—or maybe the next Silverado?—echoed through the canyons of Wall Street as investors prepared for the worst.

SQL для тестировщика from sg


Telegram SQL для тестировщика
FROM USA